//
//  RSWDataOperation+InnerNews.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 17/1/16.
//  Copyright © 2017年 com.xtion.crm. All rights reserved.
//

#import "RSWDataOperation+InnerNews.h"
#import "RSWRESTService+InnerNews.h"

@implementation RSWDataOperation (InnerNews)

-(void)getInnerNewsSearch:(NSString*) search column:(NSString*)column pageIndex:(NSInteger)pageIndex pageSize:(NSInteger)pageSize completion:(void(^)(NSInteger nResult,NSArray *list,NSError *error))completion
{
    EDOMRequestStateType stateType = [super requestAsyncBlock:^
      {
          [self pullRefreshViewBegin];
          
          XLGResult *r = nil;
          RSWRESTService *ser = [[RSWRESTService alloc] initWithDataOperationManagerDelegate:nil AttachDOM:self];
          if(ser != nil)
          {
              NSString *token = [XLGContext context].m_token;
              
              r = [ser getInnerNewsSearch:search column:column token:token pageIndex:pageIndex pageSize:pageSize];
              
              [self detachDataOperationManager:@[ser]];
          }
          
          [self requestResult:r.outResult output:r.outObj error:r.outError completion:completion];
          
          [self pullRefreshViewEnd];
      }];
    if(stateType == EDOMRequestStateTypeCanNotRequest)
        completion(TERMINATEREADWRITE,nil,nil);

}
@end
